/*
 * Copyright (C) 2010 Imavis Srl
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.imavis.avimuxer;

import java.io.IOException;
import java.util.Date;

/**
 *
 * @author Aldo Brucale
 */
interface AviMuxer {
    /**
     * Writes end-of-file values to the headers, then closes the output file.
     */
    void close() throws IOException;

    /**
     * Returns the predicted length of the output file, if closed now.
     */
    long length();

    /**
     * Writes all the headers to the output file.
     */
    void open() throws IOException;

    /**
     * Sets the framerate.
     * The new value is written to the file immediately.
     *
     * @param rate frame rate numerator (in Hz)
     * @param scale frame rate denominator
     * @see #close()
     */
    void setFramerate(int rate, int scale) throws IOException;

    /**
     * Sets the resolution.
     * The new value is written to the file immediately.
     *
     * @param width horizontal resolution
     * @param height vertical resolution
     * @see #close()
     */
    void setResolution(int width, int height) throws IOException;

    /**
     * Adds a frame to the first video stream ("00dc").
     */
    void write(byte[] data, Date timestamp, boolean isKeyFrame) throws
            IOException;
}
